<!DOCTYPE html>
<html lang="en">
  <head>
<!--    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">-->
    <link rel="stylesheet" href="style.css">
<!--    <link href="sb-admin.css" rel="stylesheet">
    <link rel="stylesheet" href="font-awesome.min.css">-->
    <title>Health Promotion</title>

        
  </head>

  <body id = "background">
      <?php
include_once 'healthclass.php';
include_once 'subdistrict.php';
include_once 'choclass.php';
?>
    
<!--      <div style="height:120px">
          Health information system
<img src="Images/healthbanner.JPG">
      </div>-->
     
      <div id = "homepage">
          
          <table style ="float: left; width: 230px">
              
              <tr>
                  <td>
                    <div id = "navigation">
            <div><a href="index_1.php"><i class="fa fa-dashboard"></i> Dashboard</a></div>
            <div><a href="health.php"><i class="fa fa-table"></i>Health Promotions</a></div>
            <div class="active"><a href="charts.php"><i class="fa fa-bar-chart-o"></i> Questions And Answers</a></div>
            </div>  
                  </td>
                  
                 
                  </tr>
                  
          </table>
          
           <table>
                      <tr>
                  <!--<td style="background-color: yellow">g</td>-->
                  
                  <td>
                      <div id = "page"> 
                          <img src="Images/banner.jpg">
                          <br>
                          <br>
                          <br>
                          
                          <div id = "formDiv">
                            <form role="form" >
                                
                                <div class="col-lg-6" style="float: left">
              <div class="form-group">
                <label>Topic</label>
                <input class="form-control" name = "topic">
              </div>
                
                <div class="form-group">
                <label>Subdistrict</label>
                <?php
                $district = new subdistrict();
                $district->get_all_subdistricts();
                $row =$district->fetch();
                echo"<select class='form-control' name = 'district'>";
                while($row)
                {
                
                echo"<option value =$row[subdistrict_id]>$row[subdistrict_name]</option>";
                   $row=$district->fetch();
                }
                
                echo"</select>";
                ?>
                
              </div>

              <div class="form-group">
                <label>Target Audience</label>
                <input class="form-control" name = "audience">
              </div>
                
                <div class="form-group">
                <label>Venue</label>
                <input class="form-control" name ="venue">
              </div>
                
                <div class="form-group">
                <label>Longitude
                </label><br>
                <input class="form-control" name = "longitude">
              </div>
                
                <div class="form-group">
                <label>Latitude
                </label><br>
                <input class="form-control" name = "latitude">
              </div>
                
</div>
            
             
                                <div style="float:left; padding-left: 200px">
                  <div class="form-group">
                <label>Method</label>
                <textarea class="form-control" name = "method" rows ="4" cols = "40"></textarea>
              </div>
                
                <div class="form-group">
                <label>Number of Appearances
                </label><br>
                <input class="form-control" name = "numappearances">
              </div>
                
                <div class="form-group">
                <label>Remarks
                </label><br>
                    <textarea class="form-control" name ="remarks" rows = 4 cols="40"></textarea>
              </div>


              <div class="form-group">
                <label>Choose an image</label>
                <input type="file" name = "file">
              </div>

              <div class="form-group">
                <label>Date</label>
                <input class="form-control" type="date" name = "date">
              </div>

              <div class="form-group">
                <label>Month</label>
                <select class='form-control' name = 'month'>
                    
			<option value="January">Jan</option>
			<option value="Febuary">Feb</option>
			<option value="March">Mar</option>
			<option value="April">Apr</option>
			<option value="May">May</option>
			<option value="June">Jun</option>
			<option value="July">Jul</option>
			<option value="August">Aug</option>
			<option value="September">Sep</option>
			<option value="October">Oct</option>
			<option value="November">Nov</option>
			<option value="December">Dec</option>
		</select>
              
              </div>
<button type="submit" class="btn btn-default">Submit</button>
              <button type="reset" class="btn btn-default">Reset</button> 
            </div> 
            </form>  
                          </div>
                        
              
                          </div>

                      
                  </td>
              </tr>
                  </table>  
      </div>
            
                 
      
      
  </body>
</html>




    <?php
    
 if(isset($_POST))
    {
        $topic = "";
        if(isset($_REQUEST['topic']))
        {
            $topic = ($_REQUEST['topic']);
        }
        
        $districtid = "";
        if(isset($_REQUEST['district']))
        {
            $districtid = ($_REQUEST['district']);
        }
        
        $audience = "";
        if(isset($_REQUEST['audience']))
        {
            $audience = ($_REQUEST['audience']);
        }
        
        $venue = "";
        if(isset($_REQUEST['venue']))
        {
            $venue = ($_REQUEST['venue']);
        }
        
        $longitude = "";
        if(isset($_REQUEST['longitude']))
        {
            $longitude = ($_REQUEST['longitude']);
        }
        
        $latitude = "";
        if(isset($_REQUEST['latitude']))
        {
            $latitude = ($_REQUEST['latitude']);
        }
        
        $method = "";
        if(isset($_REQUEST['method']))
        {
            $method = ($_REQUEST['method']);
        }
        
        $numapp = "";
        if(isset($_REQUEST['numappearances']))
        {
            $numapp = ($_REQUEST['numappearances']);
        }
        
        $remarks = "";
        if(isset($_REQUEST['remarks']))
        {
            $remarks = ($_REQUEST['remarks']);
        }
        
        $date = "";
        if(isset($_REQUEST['date']))
        {
            $date = ($_REQUEST['date']);
        }
        
        $month = "";
        if(isset($_REQUEST['month']))
        {
            $month = ($_REQUEST['month']);
        }
        
        $image = "";
        if(isset($_REQUEST['file']))
        {
            $image = $_REQUEST['file'];
        }
        
        
        
        $promotion = new healthclass();
        $promotion->add_promotion($date, $venue, $topic, $method, $audience, $numapp, $remarks, $month, $latitude, $longitude, $image, 1, $districtid);
    }
    ?>
    
    
    
    
    
    
    
    
    
    
    
    
  

















